#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s1;
    string s2;
    cin >> s1;
    cin >> s2;
    int m = s1.size();
    int n = s2.size();
    int max_equal = 0;
    for (int i = 0; i <= n - m; i++)
    {
        int cnt = 0;
        for (int j = 0; j < m; j++)
        {
            if (s2[i + j] == s1[j])
                cnt++;
        }
        max_equal = max(cnt, max_equal);
    }
    cout << n - (n - m + max_equal) << endl;
    return 0;
}

class Solution {
public:
    ListNode* reverseBetween(ListNode* head, int m, int n) {
        ListNode* cur = head;
        ListNode* newhead = nullptr;
        ListNode* sentry = new ListNode(0);
        sentry->next = head;
        int k = m;
        ListNode* prev = sentry;
        while (--k)
        {
            prev = cur;
            cur = cur->next;
        }
        int t = n - m + 1;
        ListNode* tail = cur;
        while (t--)
        {
            ListNode* next = cur->next;
            cur->next = newhead;
            newhead = cur;
            cur = next;
        }
        prev->next = newhead;
        tail->next = cur;
        ListNode* tmp = sentry->next;
        delete sentry;
        return tmp;
    }
};